using System;
using System.Collections.Generic;
using System.Text;
using Entities;
using DAL;

namespace BUS
{
  public   class tbTrangThaiBUS
    {
        public static void Insert(tbTrangThai trangthai)
        {
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            trangthaiDAL.Insert(trangthai);

        }
        public static void Uptate(tbTrangThai trangthai)
        {
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            trangthaiDAL.Update(trangthai);

        }
        public static void Delete(int iD)
        {
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            trangthaiDAL.Delete(iD);
        }
        public static tbTrangThaiCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            return trangthaiDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbTrangThaiCollection GetAll()
        {
            int total = 0;
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            return trangthaiDAL.Get("where 1=1", 0, 0,
            tbTrangThaiColumns.MaTT.ToString(),
            "ASC", out total);
        }
        public static tbTrangThai GetByID(int iD)
        {
            int total = 0;
            tbTrangThaiDAL trangthaiDAL = new tbTrangThaiDAL();
            tbTrangThaiCollection trangthaiCollection = trangthaiDAL.Get("where " +
            tbTrangThaiColumns.MaTT.ToString() + "=" + iD.ToString(),
            0, 0, tbTrangThaiColumns.MaTT.ToString(), "ASC", out total);
            if (trangthaiCollection.Count > 0)
                return trangthaiCollection[0];
            return null;
        }
    }
}
